package com.atguigu.day14.exception.accountexception;

import org.junit.Test;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/16 14:19
 * @注释
 */
public class Account {
    private String id;
    private double balance;

    public Account(String id, double balance) {
        this.id = id;
        this.balance = balance;
    }

    public Account() {
    }

    public void withdrawal(double amount){
        if(amount < 0){
            throw new IllegalArgumentException("取款金额有误,不能为负数");
        }
        if (amount > balance){
            throw new UnsupportedOperationException("取款金额不足,不支持当前取款操作");
        }
    }
    public void deposit(double amount){
        if(amount < 0){
            throw new IllegalArgumentException("存款金额有误,不能为负数");
        }
    }


}
